package sseGameApps.controller.mdkbr.confirm;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;

import sseGameApps.model.mdkbr.MdKbrUser;
import sseGameApps.service.mdkbr.MdKbrUserService;

public class IndexController extends Controller {

    private MdKbrUserService service = new MdKbrUserService();

    @Override
    public Navigation run() throws Exception {

        MdKbrUser mdKbrUser = service.getMdKbrUser(asString("userId"));

        if(mdKbrUser != null){
            requestScope("userId", mdKbrUser.getUserId());
            requestScope("playerName", mdKbrUser.getPlayerName());
            requestScope("playerSchool", mdKbrUser.getPlayerSchool());
            requestScope("playerSex", mdKbrUser.getPlayerSex());
            requestScope("playerType", mdKbrUser.getPlayerType());
            requestScope("playerCG", mdKbrUser.getPlayerCGType());
            requestScope("firstLogin", "1");
        } else {
            requestScope("userId", "");
            requestScope("playerName", "");
            requestScope("playerSchool", "");
            requestScope("playerSex", "");
            requestScope("playerType", "");
            requestScope("playerCG", "");
            requestScope("firstLogin", "1");
        }

        return forward("index.jsp");
    }
}
